class Solution {
public:
    int stockManagement(vector<int>& stock) {
        for (int i = 1;i < stock.size();i++)
        {
            if (stock[i] < stock[i - 1]) 
            {
                return stock[i];
            }
        }
        return stock[0];
    }
};